import request from '@/utils/request'

export function calCarbonQuantityById(id) {
  return request({
    url: '/carbon/productCarbon/cal/' + id,
    method: 'get'
  })
}

// 查询产品碳足迹列表
export function listProductCarbon(query) {
  return request({
    url: '/carbon/productCarbon/list',
    method: 'get',
    params: query
  })
}
export function downloadProductCarbon(query) {
  return request({
    url: '/carbon/productCarbon/downOther',
    method: 'get',
    params: query
  })
}

// 查询产品碳足迹详细
export function getProductCarbon(id) {
  return request({
    url: '/carbon/productCarbon/' + id,
    method: 'get'
  })
}

export function getInfoAndConsumables(id) {
  return request({
    url: '/carbon/productCarbon/consumables/' + id,
    method: 'get'
  })
}

// 新增产品碳足迹
export function addProductCarbon(data) {
  return request({
    url: '/carbon/productCarbon',
    method: 'post',
    data: data
  })
}

// 修改产品碳足迹
export function updateProductCarbon(data) {
  return request({
    url: '/carbon/productCarbon',
    method: 'put',
    data: data
  })
}

// 删除产品碳足迹
export function delProductCarbon(id) {
  return request({
    url: '/carbon/productCarbon/' + id,
    method: 'delete'
  })
}

// 导出产品碳足迹
export function exportProductCarbon(query) {
  return request({
    url: '/carbon/productCarbon/export',
    method: 'get',
    params: query
  })
}
